package first.group.ssh.keyexchange;

import first.group.ssh.ConnectionCallback;
import first.group.ssh.PacketConnectStage;
import first.group.ssh.packet.KeyExchangeInitPacket;
import first.group.ssh.version.Version;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.util.List;
import java.util.Random;

public abstract class KeyExchangeMethod {
    public interface Callback {
        public void onKeyExchanged(BigInteger secretd, byte[] sessionId);
        public void onKeyExchangeFailed();
    }
    
    public abstract String getName();
    
    public abstract MessageDigest newDigest();
    
    public abstract Exchanger newInstance(
            Version clientVersion,
            Version serverVersion,
            KeyExchangeInitPacket clientInitPacket,
            KeyExchangeInitPacket serverInitPacket,
            Random random,
            ConnectionCallback connectionCallback,
            Callback exchangeCallback
    );
    
    public static abstract class Exchanger extends PacketConnectStage {}
    
    public static final List<KeyExchangeMethod> methods = List.of(new DiffieHellmanGroupExchangeSha256());
}
